package com.example.Map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class T {
    public static void main(String[] args) {
        HashMap<Student, String> hm = new HashMap<>();

        Student s1 = new Student("xiaoshuai", 19);
        Student s2 = new Student("xiaomei", 20);
        Student s3 = new Student("xiaohei", 17);

        hm.put(s1, "江苏");
        hm.put(s2, "北京");
        hm.put(s3, "天津");

        Set<Student> keys = hm.keySet();
        for (Student key : keys) {
            String value = hm.get(key);
            System.out.println(key + "---" + value);
        }
//        System.out.println("-------------------------------------");
//
//        Set<Map.Entry<Student, String>> entries = hm.entrySet();
//        for (Map.Entry<Student, String> entry : hm.entrySet()) {
//            Student key = entry.getKey();
//            String value = entry.getValue();
//            System.out.println(key + "---" + value);
//        }
//        System.out.println("--------------------------------------");
//
//        hm.forEach((Student key, String value) -> {
//            System.out.println(key + "---" + value);
//        });
    }
}
